<!doctype html>
<html>
<head>
    <title>店铺添加</title>
    <?php $this->load->module('admin/index/page_header');?>
    <!--引入CSS-->
    <link rel="stylesheet" type="text/css" href="<?php echo URLPRE;?>static/public/Lib/webuploader/webuploader.css">
    <!--引入JS-->
    <script type="text/javascript" src="<?php echo URLPRE;?>static/public/Lib/webuploader/webuploader.js"></script>

</head>
<body>
<div class="wrap">
    <div id="home_toptip"></div>
    <div class="table_full">
    <form class="formvalidate" action="<?php echo $form_url;?>" method="post">
    <div class="h_a">店铺信息</div>
    <div class="table_full">
        <table width="100%">
            <col class="th" />
            <col/>
            <thead>

            </thead>
             <tr>
                <th>手机号码</th>
                <td>
                    <input name="Form[mobile]" id="mobile" type="text" class="input length_5" value="<?php echo $mobile;?>" validate="{required:true,isMobile:true,remote:'<?php echo $check_mobile_uri;?>'}">
                </td>
            </tr>
            <tr>
                <th>微店名称</th>
                 <td>
                    <input type="text" class="input length_5"  name="Shop[shop_name]" size="50" value="<?php echo  $shop_name;?>" validate="{required:true,rangelength:[3,18]}" />
                </td>
            </tr>
            <tr>
                <th>公司名称</th>
                <td>
                    <input name="Shop[company]" type="text" class="input length_5" validate="{required:true,rangelength:[3,18]}" value="<?php echo $company;?>">
                </td>
            </tr>
            <?php if($user_id):?>
            <tr>
                <th>头像</th>

                <td class="rowform">
                    <li><img width="100" height="100" id="avatar_box"  src="<?php echo URLPIC.$avatar ;?>"><span><span></li>

                </td>

            </tr>
            <tr>
                <th>修改头像</th>

                <td class="rowform">

                    <li><span id="filePicker">修改头像</span></li>
                </td>
            </tr>
            <?php endif;?>
            <tr>
                <th>新密码</th>
                <td><input name="Form[password]" id="password" type="password" class="input length_5" validate="{<?php if(!$user_id):?>required:true,<?php endif;?>rangelength:[6,20]}"></td>
            </tr>
            <tr>
                <th>确认密码</th>
                <td><input name="repassword" type="password" class="input length_5" validate="{<?php if(!$user_id):?>required:true,<?php endif;?>rangelength:[6,20],equalTo:'#password'}"></td>
            </tr>
            <?php if($user_id):?>
                <tr>
                <th>注册时间</th>
                <td><?php echo $reg_date ;?></td>
            </tr>
                <tr>
                <th>注册IP</th>
                <td><?php echo $reg_ip ;?></td>
            </tr>
                <tr>
                <th>最后登录时间</th>
                <td><?php echo $login_date ;?></td>
            </tr>
            <?php endif;?>
        </table>
    </div>
    <div class="h_a">基本资料</div>
    <div class="table_full">
        <table width="100%">
            <col class="th" />
            <col/>
            <tr>
                <th>真实姓名</th>
                <td><input name="Expand[realname]" type="text" class="input input_hd length_5" validate="{required:true}" value="<?php echo $realname;?>"></td>
            </tr>
            <tr>
                <th>性别</th>
                <td>
                    <select name="Expand[gender]" class="select_5">
                        <option value="2" <?php if($gender=='2'):?>selected<?php endif;?>>女</option>
                        <option value="1" <?php if($gender=='1'):?>selected<?php endif;?>>男</option>
                        <lect>
                </td>
            </tr>
        </table>
    </div>
    <div class="h_a">交易信息</div>
    <div class="table_full">
        <table width="100%">
            <col class="th" />
            <col/>
            <tr>
                <th>支付宝账户</th>
                <td>
                    <input name="Shop[alipay]" type="text" class="input length_5" validate="{required:true,rangelength:[3,18]}" value="<?php echo  $alipay;?>">
                </td>
            </tr>
        </table>
    </div>
    <div class="h_a">联系信息</div>
    <div class="table_full">
        <table width="100%">
            <col class="th" />
            <col/>
            <tr>
                <th>QQ</th>
                <td>
                    <input name="Shop[qq]" type="text" class="input length_5" validate="{required:true,rangelength:[3,18],number:true}" value="<?php echo  $qq;?>">
                </td>
            </tr>
            <tr>
                <th>公司地址</th>
                <td>
                    <input name="Shop[address]" type="text" class="input length_5" validate="{required:true,rangelength:[3,50]}" value="<?php echo  $address;?>">
                </td>
            </tr>
            <tr>
                 <th>店铺状态</th>
                <td class="rowform">
                    <ul>
                        <li>
                            <label><input type="radio" value="1" name="Shop[shop_status]" checked="checked"/>启用</label>
                        </li>
                        <li>
                            <label><input type="radio" value="0" name="Shop[shop_status]" <?php if(isset($shop_status)&&!$shop_status):?>checked="checked"<?php endif;?>/>禁用</label>
                        </li>
                    </ul>
                </td>
                <td class="field"></td>
            </tr>
        </table>
    </div>
    <div class="btn_wrap">
        <div class="btn_wrap_pd">
            <button type="submit"
                    <?php if( ! $show_add_button):?>
                        disabled class="btn btn_error J_ajax_submit_btn"
                    <?php else:?>
                        class="btn btn_submit J_ajax_submit_btn"
                    <?php endif;?>>提交</button>
            <?php if( ! $show_add_button):?><span class="red">本站点微店数量达到限制,请联系销售人员</span><?php endif;?>
        </div>
    </div>
     <input type="hidden" name="user_id" value="<?php echo $user_id ;?>"/>
    </form>
    </div>
</div>
 <script type="text/javascript">
    <?php if($user_id):?>
        upload_image_2("<?php echo site_url('weixin/wshop/upload_avatar/?uid='.$user_id);?>",'filePicker','face_image','avatar_box');
    <?php endif;?>
    <?php if(!$user_id):?>
     $(function(){
         $('#mobile').blur(function(){
             var mobile = $.trim($('#mobile').val());
             if (!(mobile.length == 11 && /^(((13[0-9]{1})|(15[0-9]{1})|(14[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/.test(mobile))){
                return false;
             }
             var url = "<?php echo site_url('/member/index/verify_gateway/') ;?>" ;
             var postData = 'Form%5Bmobile%5D='+mobile+'&action=mobile_ver';
             $.ajax({
                 type: "GET",
                 url: url,
                 data: postData,
                 dataType:'json',
                 success: function(json){
                     if(json=='手机号重复'){
                         var URL = "<?php echo site_url('weixin/wshop/js_shop_edit_redirect?mobile=')?>";
                         window.location = URL+$('#mobile').val();
                     }
                 }
             });
         })
     })
     <?php endif;?>
    </script>
</body>
</html>